#include <Windows.h>
#include <stdio.h>
#include <tchar.h>

typedef int (*ADD)(int, int);
typedef int (*SUB)(int, int);

void main()
{
	HMODULE hModule = LoadLibrary(_T("DllLib.dll"));
	if (NULL != hModule)
	{
		ADD Add = (ADD)GetProcAddress(hModule, "Add");
		SUB Sub = (SUB)GetProcAddress(hModule, "Sub");
		if (NULL != Add)
		{
			int nLeft, nRight;
			_tprintf(_T("please input two data for calulate: "));
			scanf("%d %d", &nLeft, &nRight);
			_tprintf(_T("Add(%d, %d) = %d\n"), nLeft, nRight, Add(nLeft, nRight));
			_tprintf(_T("Sub(%d, %d) = %d\n"), nLeft, nRight, Sub(nLeft, nRight));
		}

		FreeLibrary(hModule);
	}

	system("pause");
	return;
}